package com.lzh.oop.bean;

public class Rectangle_imp implements IShape{
    Point ptTopLeft;
    Point ptTopRight;
    int width;
    int height;

    Rectangle_imp() {

    }
    public Rectangle_imp(Point topleft, int hight, int width){
        ptTopLeft = topleft;
        this.width = width;
        this.height = hight;
        ptTopRight = new Point(topleft.getX()+width, topleft.getY());
    }

    @Override
    public double perimeter() {
        return 2*(width+height);
    }

    @Override
    public double area() {
        return width*height;
    }

    @Override
    public void draw() {
        System.out.println("绘制矩形");
        System.out.println("左上角坐标："+ptTopLeft.getX()+","+ptTopLeft.getY());
        System.out.println("右上角坐标："+ptTopRight.getX()+","+ptTopRight.getY());
    }
}
